﻿﻿/*加载分页工具条
 * 
 * total 总计录数
 * currentpage 当前页
 * size 每页显示条目数
 * visibPage 工具条显示几页
 * page 跳转页面
 * 
 */
var if_firstime = false; 
function pagination(option,param){
	if(option.total==0)
		totalPages=1;
	else 
		totalPages=option.total%option.size==0?parseInt(option.total/option.size):parseInt(option.total/option.size)+1;
	if(option.visibPage>totalPages)
		option.visibPage=totalPages;
	visiblePages=!option.visibPage?3:option.visibPage;
    currentPage=!option.currentpage?1:option.currentpage;
    $.jqPaginator("#pagination", {  
        totalPages: totalPages,  
        visiblePages: visiblePages,  
        currentPage: currentPage,  
        first: '<li class="prev"><a href="javascript:;">首页</a></li>',  
        prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',  
        next: '<li class="next"><a href="javascript:;">下一页</a></li>',  
        last: '<li class="prev"><a href="javascript:;">末页</a></li>',  
        page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',  
        onPageChange: function (page, type) {
        	if (type === "change") {
            if(if_firstime){  
                if_firstime = false;  
            }else if(!if_firstime){  
            	if(!param)
					param={};
				param.page=page-1;
				param.size=option.size;
				$("#frameReft").load(option.pagePath, param);
            }  
        	}     
        }  
    });    
}  

